home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_bas / t2win_32.zip / _SERIALZ.FRM < prev    next >
Text File  |  1996-05-14  |  8KB  |  256 lines

  1. VERSION 4.00
  2. Begin VB.Form frmSerialization 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Serialization"
  5.    ClientHeight    =   4020
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   8340
  9.    Height          =   4425
  10.    Left            =   1830
  11.    MaxButton       =   0   'False
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   4020
  14.    ScaleWidth      =   8340
  15.    ShowInTaskbar   =   0   'False
  16.    Top             =   2925
  17.    Width           =   8460
  18.    Begin VB.TextBox txt_Result 
  19.       BackColor       =   &H00C0C0C0&
  20.       BorderStyle     =   0  'None
  21.       Height          =   3270
  22.       Left            =   105
  23.       Locked          =   -1  'True
  24.       MultiLine       =   -1  'True
  25.       ScrollBars      =   2  'Vertical
  26.       TabIndex        =   0
  27.       Top             =   630
  28.       Width           =   8100
  29.    End
  30.    Begin Threed.SSPanel SSPanel1 
  31.       Align           =   1  'Align Top
  32.       Height          =   480
  33.       Left            =   0
  34.       TabIndex        =   1
  35.       Top             =   0
  36.       Width           =   8340
  37.       _Version        =   65536
  38.       _ExtentX        =   14711
  39.       _ExtentY        =   847
  40.       _StockProps     =   15
  41.       ForeColor       =   -2147483640
  42.       BackColor       =   12632256
  43.       Begin VB.ComboBox cmb_Function 
  44.          Height          =   315
  45.          Left            =   1365
  46.          TabIndex        =   2
  47.          Top             =   90
  48.          Width           =   5625
  49.       End
  50.       Begin Threed.SSCommand cmdNP 
  51.          Height          =   300
  52.          Index           =   1
  53.          Left            =   7980
  54.          TabIndex        =   6
  55.          Top             =   90
  56.          Width           =   255
  57.          _Version        =   65536
  58.          _ExtentX        =   450
  59.          _ExtentY        =   529
  60.          _StockProps     =   78
  61.          Caption         =   ">"
  62.          BevelWidth      =   1
  63.          Font3D          =   3
  64.          RoundedCorners  =   0   'False
  65.          Outline         =   0   'False
  66.       End
  67.       Begin Threed.SSCommand cmdNP 
  68.          Height          =   300
  69.          Index           =   0
  70.          Left            =   7140
  71.          TabIndex        =   5
  72.          Top             =   90
  73.          Width           =   255
  74.          _Version        =   65536
  75.          _ExtentX        =   450
  76.          _ExtentY        =   529
  77.          _StockProps     =   78
  78.          Caption         =   "<"
  79.          BevelWidth      =   1
  80.          Font3D          =   3
  81.          RoundedCorners  =   0   'False
  82.          Outline         =   0   'False
  83.       End
  84.       Begin VB.Label Label2 
  85.          Caption         =   "&Select a function"
  86.          Height          =   255
  87.          Left            =   90
  88.          TabIndex        =   4
  89.          Top             =   120
  90.          Width           =   1275
  91.       End
  92.       Begin Threed.SSCommand SSCommand1 
  93.          Default         =   -1  'True
  94.          Height          =   300
  95.          Left            =   7455
  96.          TabIndex        =   3
  97.          Top             =   90
  98.          Width           =   465
  99.          _Version        =   65536
  100.          _ExtentX        =   820
  101.          _ExtentY        =   529
  102.          _StockProps     =   78
  103.          Caption         =   "&Go"
  104.          BevelWidth      =   1
  105.          RoundedCorners  =   0   'False
  106.          Outline         =   0   'False
  107.       End
  108.    End
  109. End
  110. Attribute VB_Name = "frmSerialization"
  111. Attribute VB_Creatable = False
  112. Attribute VB_Exposed = False
  113. Option Explicit
  114. Option Base 1
  115.  
  116. Private Const Iteration = 250
  117.  
  118. Dim IsLoaded         As Integer
  119.  
  120. Dim TimerStartOk     As Integer
  121. Dim TimerCloseOk     As Integer
  122.  
  123. Dim TimerHandle      As Integer
  124. Dim TimerValue       As Long
  125.  
  126. Private Sub cmdNP_Click(Index As Integer)
  127.  
  128.    Call sub_NextPrev(cmb_Function, Index)
  129.  
  130. End Sub
  131.  
  132.  
  133. Private Sub cmb_Function_Click()
  134.    
  135.    If (IsLoaded = False) Then Exit Sub
  136.    
  137.    Call cDisableFI(mdiT2W.Picture1)
  138.    
  139.    txt_Result = ""
  140.    
  141.    Select Case cmb_Function.ListIndex
  142.       Case 0
  143.          Call TestSerialization
  144.    End Select
  145.  
  146.    DoEvents
  147.    Call cEnableFI(mdiT2W.Picture1)
  148.    
  149. End Sub
  150.  
  151.  
  152. Private Sub Form_Activate()
  153.  
  154.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  155.  
  156. End Sub
  157.  
  158. Private Sub Form_Load()
  159.  
  160.    IsLoaded = False
  161.    
  162.    Show
  163.  
  164.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_serialz.t2w")
  165.    
  166.    IsLoaded = True
  167.    
  168. End Sub
  169.  
  170. Private Sub SSCommand1_Click()
  171.    
  172.    Call cmb_Function_Click
  173.    
  174. End Sub
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182. Private Sub TestSerialization()
  183.  
  184.    Dim intResult        As Integer
  185.    Dim strResult        As String
  186.    Dim strDisplay       As String
  187.    
  188.    Dim i                As Integer
  189.    Dim j                As Integer
  190.    
  191.    Dim getSD            As tagSERIALDATA
  192.    Dim putSD            As tagSERIALDATA
  193.    
  194.    Dim File1            As String
  195.    Dim File2            As String
  196.  
  197.    strResult = ""
  198.    strDisplay = ""
  199.    
  200.    File1 = T2WFileTest
  201.    File2 = "autoexec.serialized"
  202.    
  203.    strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
  204.    
  205.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  206.  
  207.    putSD.Description1 = "T2WIN-32 demo"
  208.    putSD.Description2 = "Under the blue sky"
  209.    putSD.Number = 136
  210.    strDisplay = strDisplay & "Put/Modify '" & Trim$(putSD.Description1) & "' - '" & Trim$(putSD.Description2) & "' - '" & putSD.Number & "' into file '" & File2 & "' is " & IIf(cSerialPut(File2, putSD) = True, "OK", "KO") & vbCrLf & vbCrLf
  211.    
  212.    intResult = cSerialGet(File2, getSD)
  213.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  214.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  215.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  216.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  217.       
  218.    strDisplay = strDisplay & "Add 2 to serialized number part into file '" & File2 & "' is " & IIf(cSerialInc(File2, 2) = True, "OK", "KO") & vbCrLf & vbCrLf
  219.    intResult = cSerialGet(File2, getSD)
  220.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  221.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  222.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  223.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  224.  
  225.    strDisplay = strDisplay & "Substract 9 to serialized number part into file '" & File2 & "' is " & IIf(cSerialInc(File2, -9) = True, "OK", "KO") & vbCrLf & vbCrLf
  226.    intResult = cSerialGet(File2, getSD)
  227.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  228.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  229.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  230.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  231.  
  232.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  233.  
  234.    strDisplay = strDisplay & "Remove serialization in '" & File2 & "' is " & IIf(cSerialRmv(File2) = True, "unserialized", "not unserialized") & vbCrLf & vbCrLf
  235.  
  236.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  237.  
  238.    txt_Result = strDisplay
  239.    
  240.    'time the function
  241.  
  242.    TimerHandle = cTimerOpen()
  243.    TimerStartOk = cTimerStart(TimerHandle)
  244.    
  245.    For i = 1 To Iteration
  246.       intResult = cSerialGet(File2, getSD)
  247.    Next i
  248.    
  249.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  250.    
  251.    TimerCloseOk = cTimerClose(TimerHandle)
  252.  
  253. End Sub
  254.  
  255.  
  256.